<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
		<html>
		<head>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
		<title>Blowfish</title>
		<META HTTP-EQUIV="EXPIRES" CONTENT=0>
		<link rel="stylesheet" href="../../../../docs.css">
		</head>
		<body>
		
<br>
<h1>Io Reference</h1>
<br><br><br>
<br><br><br>
<a class='column' href='../../index.html'>Encryption</a>
&nbsp;&nbsp;<font color=#ccc>/</font>&nbsp;&nbsp;
<a class='column' href='../index.html'>Blowfish</a>
&nbsp;&nbsp;<font color=#ccc>/</font>&nbsp;&nbsp;
<b>Blowfish</b>
<br><br><br>
<br><br><br>
<table border=0 cellspacing=0 style="margin-left:8em; width:40em; line-height:1.2em;">
<tr>
<td align=right></td>
<td></td>
<td>The Blowfish object can be used to do encryption and decryption using 
the <a href=http://en.wikipedia.org/wiki/Blowfish_(cipher)>Blowfish</a> keyed, symmetric block cipher.
<p>
Example encryption and decription;

<pre>	
key := "secret"
data := "this is a message"

encryptedData := Blowfish clone setKey(key) encrypt(data)
decryptedData := Blowfish clone setKey(key) decrypt(encryptedData)
</pre>	

Or using the stream API:
<pre>	
key := "secret"
data := "this is a message"

cipher = Blowfish clone
cipher setIsEncrypting(true)
cipher setKey(key)
cipher beginProcessing
cipher inputBuffer appendSeq(data)
cipher process
cipher endProcess
encryptedData := cipher outputBuffer

cipher = Blowfish clone
cipher setIsEncrypting(false)
cipher setKey(key)
cipher beginProcessing
cipher inputBuffer appendSeq(encryptedData)
cipher process
cipher endProcess
decryptedData := cipher outputBuffer
</pre>
</td></tr>
<tr><td colspan=3>&nbsp;</td></tr>
<tr><td colspan=3>&nbsp;</td></tr>
<tr><td colspan=3>&nbsp;</td></tr>
<tr>
<td align=right>
</td>
<td></td>
<td>
<hr align=left color=#ddd height=1>
<br><br>
<a name="Blowfish-beginProcessing"></a><b>
beginProcessing
</b>
<p>
<div class=slotDescription>
Sets the key from the key slot and initializes the cipher.
</div>
<a name="Blowfish-decrypt"></a><b>
decrypt(aSequence)
</b>
<p>
<div class=slotDescription>
Returns an decrypted version of aSequence.
</div>
<a name="Blowfish-encrypt"></a><b>
encrypt(aSequence)
</b>
<p>
<div class=slotDescription>
Returns an encrypted version of aSequence.
</div>
<a name="Blowfish-endProcessing"></a><b>
endProcessing
</b>
<p>
<div class=slotDescription>
Finish processing remaining bytes of inputBuffer.
</div>
<a name="Blowfish-inputBuffer"></a><b>
inputBuffer
</b>
<p>
<div class=slotDescription>
Returns the input buffer.
</div>
<a name="Blowfish-outputBuffer"></a><b>
outputBuffer
</b>
<p>
<div class=slotDescription>
Returns the output buffer.
</div>
<a name="Blowfish-process"></a><b>
process
</b>
<p>
<div class=slotDescription>
Process the inputBuffer and appends the result to the outputBuffer.
	The processed inputBuffer is emptied except for the spare 
	bytes at the end which don't fit into a cipher block.
</div>
<a name="Blowfish-setIsEncrypting"></a><b>
setIsEncrypting(aBool)
</b>
<p>
<div class=slotDescription>
If aBool is true, encrypting mode is on, otherwise, decrypting mode is on.
</div>
</td>
</tr>
</table>
<br><br><br><br><br>
</body>
</html>
